SSD Detection Script  will not working

Hello,

 i wrote a script to detect SSD's. When run de script  on lokal Client it works fine.

In  taskseq  it will not working  with error "+ $diskspeed = $test[5].Trim <<<< ("")"  and i think  the Process from WINSAT is not starting.

I have start the script from commandline "powershell.exe  -command "%scriptroot%\custom\ssdtest.ps1"" or from MDT2012SP1 run Powershellscript with same Error.

Why  run not winsat  ??

Please Help

thanks henrik.b

Function ssdtest
{

$pinfo = New-Object System.Diagnostics.ProcessStartInfo
$pinfo.FileName = "C:\Windows\system32\winsat.exe"
$pinfo.Arguments = "disk -seq -read"
$pinfo.RedirectStandardOutput = $true
$pinfo.RedirectStandardError = $true
$pinfo.UseShellExecute = $false



$p = New-Object System.Diagnostics.Process
$p.StartInfo = $pinfo
$p.Start() | out-null
$p.WaitForExit()

$output = $p.StandardOutput.ReadToEnd()
$test = $output.Split(">") 


$diskspeed = $test[5].Trim("")
$Tempspeed = $diskspeed.Substring(($diskspeed.Length -3 ))


if ($Tempspeed -cge "6.9")
{
$ISSSDDISK = "TRUE";

}
else
{
$ISSSDDISK = "False";

}

$ISSSDDISK

$ssddisk = New-Object -COMObject Microsoft.SMS.TSEnvironment 
$ssddisk.Value("SSDDISK") = $ISSSDDISK

}

ssdtest

July 11th, 2013 11:08am

Could this be a x86 vs x64 issue (and file system redirection)? Double check if winsat.exe is present in that folder.
Free Windows Admin Tool Kit Click here and download it now
July 11th, 2013 11:29am

Hello

winsat.exe is present in that Folder and the same Error on  x64 or x86 Systems.

I Thing  the Problem  is that PowerShell not wait for Finish  winsat Process in MDT

July 12th, 2013 4:54am

You should add debugging steps and/or logging to your script then. That will help you to understand what step might cause problems.
Free Windows Admin Tool Kit Click here and download it now
July 12th, 2013 5:52am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics